<template>
  <div class="dashboard-container">
    <div class="dashboard-text">
      <h1>欢迎使用掘金后台管理系统</h1>
      <p>这是一个基于Vue 3 + Element Plus的后台管理系统</p>
    </div>
    
    <el-row :gutter="20" class="panel-group">
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-people">
            <el-icon class="card-panel-icon">
              <User />
            </el-icon>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">用户数量</div>
            <div class="card-panel-num">1,024</div>
          </div>
        </div>
      </el-col>
      
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <el-icon class="card-panel-icon">
              <Document />
            </el-icon>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">文章数量</div>
            <div class="card-panel-num">256</div>
          </div>
        </div>
      </el-col>
      
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-money">
            <el-icon class="card-panel-icon">
              <ChatDotRound />
            </el-icon>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">评论数量</div>
            <div class="card-panel-num">512</div>
          </div>
        </div>
      </el-col>
      
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-shopping">
            <el-icon class="card-panel-icon">
              <Star />
            </el-icon>
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">会员数量</div>
            <div class="card-panel-num">128</div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { User, Document, ChatDotRound, Star } from '@element-plus/icons-vue'
</script>

<style lang="scss" scoped>
.dashboard-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  min-height: calc(100vh - 84px);
}

.dashboard-text {
  text-align: center;
  margin-bottom: 40px;
  
  h1 {
    color: #303133;
    margin-bottom: 16px;
  }
  
  p {
    color: #606266;
    font-size: 16px;
  }
}

.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}
</style>